let lastOptionTime = new Date().getTime();
let currentTime = new Date().getTime();
let timeOut = 0.5 * 60 * 1000;

window.onload = function () {
    console.log(123);
    
    window.document.onmousedown = function () {
        let token = window.localStorage.getItem('token')
        lastOptionTime = Number(window.localStorage.getItem('lastOptionTime'))
        if (token && lastOptionTime) {
            currentTime = new Date().getTime()
            if (currentTime - lastOptionTime > timeOut) {
                window.localStorage.clear()
                if (window.location.pathname == '/login') return;
                window.location.pathname = '/login';
            } else {
                window.localStorage.setItem('lastOptionTime', new Date().getTime().toString())
            }
        } else {
            if (token) {
                window.localStorage.setItem('lastOptionTime', new Date().getTime().toString())
            } else {
                if (window.location.pathname == '/login') return;
                window.location.pathname = '/login';
            }
        }
    }
}

export { }